<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/favicon.ico">
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
            <script type="text/javascript" src="lib/html5shiv.js"></script>
            <script type="text/javascript" src="lib/respond.min.js"></script>
            <![endif]-->
    <link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" href="./../lib/layui/css/layui.css">
    <!--[if IE 6]>
            <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
            <script>DD_belatedPNG.fix('*');</script>
            <![endif]-->
    <title>业绩</title>
</head>

<body>
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 团队管理 <span
            class="c-gray en">&gt;</span>
        业绩 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);"
            title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="page-container">
        手机号：
        <input type="text" class="input-text" style="width:150px" placeholder="输入商品名称" id="mobile" name="">
        <button type="submit" class="btn btn-success" name="" data-type="reload" id="search"><i class="Hui-iconfont">&#xe665;</i>
            搜索</button>
        <table class="layui-hide" id="achievement" lay-filter="achievement"></table>
    </div>
    <input type="" name="details_id" id="details_id" value="" style="display:none;" />
    <script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="./../static/js/common.js"></script>
    <script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
    <script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script>
    <script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script>
    <script type="text/javascript" src="./../lib/layui/layui.js"></script>
    <script>
        layui.use('table', function () {
            var table = layui.table;
            dataTable = table.render({
                elem: '#achievement',
                cellMinWidth: 80,
                url: admin_url + '/kvmAchieLog/achieLogList',
                // id为重置表格，进行搜索
                id: 'reload',
                request: {
                    pageName: 'page',
                    limitName: 'size'
                },
                // 传输模式
                // contentType: 'application/json',
                paresData: function (res) {
                    return {
                        'data': res.data
                    }
                },
                response: {
                    statusCode: 200
                },
                // 传入数据
                where: {
                    tokenUserId: userId,
                    token: token
                },
                // 回调
                done: function (res, curr, count) {
                },
                method: 'post',
                'page': 'true',
                cols: [[
                    { checkbox: true, align: 'center' },
                    {
                        field: 'name', title: '姓名', align: 'center', templet: function (obj) {
                            var item;
                            $.ajax({
                                type: "post",
                                xhrFields: { withCredentials: true },
                                url: admin_url + '/kvmUser/userInfo',
                                data: { tokenUserId: userId, token: token, id: obj.userId },
                                async: false,
                                success: function (data) {
                                    if (data.code == 200 && data.data != null) {
                                        item = '<span>' + data.data.userName + '</span>'

                                    } else {
                                        item = '<span></span>'
                                    }
                                    return item
                                }
                            })
                            return item
                        }
                    },
                    {
                        field: 'mobile', title: '手机号', align: 'center', templet: function (obj) {
                            var phone;
                            $.ajax({
                                type: "post",
                                xhrFields: { withCredentials: true },
                                url: admin_url + '/kvmUser/userInfo',
                                data: { tokenUserId: userId, token: token, id: obj.userId },
                                async: false,
                                success: function (data) {
                                    if (data.code == 200 && data.data != null) {
                                        phone = '<span>' + data.data.userCode + '</span>'

                                    } else {
                                        phone = '<span></span>'
                                    }
                                    return phone
                                }
                            })
                            return phone
                        }
                    },
                    {
                        field: 'mobile', title: '直属', align: 'center', templet: function (obj) {
                            var phone;
                            $.ajax({
                                type: "post",
                                xhrFields: { withCredentials: true },
                                url: admin_url + '/kvmUser/userInfo',
                                data: { tokenUserId: userId, token: token, id: obj.downUserId },
                                async: false,
                                success: function (data) {
                                    if (data.code == 200 && data.data != null) {
                                        phone = '<span>' + data.data.userCode + '</span>'

                                    } else {
                                        phone = '<span></span>'
                                    }
                                    return phone
                                }
                            })
                            return phone
                        }
                    },
                    { field: 'orderNo', title: '订单编号', align: 'center' },
                    { field: 'total', title: '业绩', align: 'center' },
                    {
                        field: 'type', title: '业绩类型', align: 'center', templet: function (obj) {
                            if (obj.type == 0) {
                                return '<span  class="layui-badge layui-bg-blue">进货</span>'
                            } else if (obj.type == 1) {
                                return '<span  class="layui-badge layui-bg-orange">礼包</span>'
                            } else {
                                return '<span></span>'
                            }
                        }
                    }
                ]]
            })
            // 搜索功能
            $('#search').on('click', function () {
                var mobile = $("#mobile").val();
                dataTable.reload({
                    where: {
                        "token": token,
                        "tokenUserId": userId,
                        "mobile": mobile
                    }, page: {
                        curr: 1
                    }
                });
            });
        })
    </script>
</body>

</html>